package com.ruoyi.kiku.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.kiku.mapper.MyTravelDiaryMapper;
import com.ruoyi.kiku.domain.MyTravelDiary;
import com.ruoyi.kiku.service.IMyTravelDiaryService;

/**
 * 旅行日记Service业务层处理
 *
 * @author TT
 * @date 2025-08-23
 */
@Service
public class MyTravelDiaryServiceImpl implements IMyTravelDiaryService
{
    @Autowired
    private MyTravelDiaryMapper myTravelDiaryMapper;

    /**
     * 查询旅行日记
     *
     * @param id 旅行日记主键
     * @return 旅行日记
     */
    @Override
    public MyTravelDiary selectMyTravelDiaryById(Long id)
    {
        return myTravelDiaryMapper.selectMyTravelDiaryById(id);
    }

    /**
     * 查询旅行日记列表
     *
     * @param myTravelDiary 旅行日记
     * @return 旅行日记
     */
    @Override
    public List<MyTravelDiary> selectMyTravelDiaryList(MyTravelDiary myTravelDiary)
    {
        return myTravelDiaryMapper.selectMyTravelDiaryList(myTravelDiary);
    }

    /**
     * 新增旅行日记
     *
     * @param myTravelDiary 旅行日记
     * @return 结果
     */
    @Override
    public int insertMyTravelDiary(MyTravelDiary myTravelDiary)
    {
        myTravelDiary.setCreateTime(DateUtils.getNowDate());
        return myTravelDiaryMapper.insertMyTravelDiary(myTravelDiary);
    }

    /**
     * 修改旅行日记
     *
     * @param myTravelDiary 旅行日记
     * @return 结果
     */
    @Override
    public int updateMyTravelDiary(MyTravelDiary myTravelDiary)
    {
        myTravelDiary.setUpdateTime(DateUtils.getNowDate());
        return myTravelDiaryMapper.updateMyTravelDiary(myTravelDiary);
    }

    /**
     * 批量删除旅行日记
     *
     * @param ids 需要删除的旅行日记主键
     * @return 结果
     */
    @Override
    public int deleteMyTravelDiaryByIds(Long[] ids)
    {
        return myTravelDiaryMapper.deleteMyTravelDiaryByIds(ids);
    }

    /**
     * 删除旅行日记信息
     *
     * @param id 旅行日记主键
     * @return 结果
     */
    @Override
    public int deleteMyTravelDiaryById(Long id)
    {
        return myTravelDiaryMapper.deleteMyTravelDiaryById(id);
    }
}
